package com.munhrasoft.dinamica.converters;

import java.util.logging.Logger;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter(value = "stringConverter")
public class StringConverter implements Converter {

    private static Logger logger = Logger.getLogger(StringConverter.class.getName());

    public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
        logger.info("getAsObject Validation Result " + arg0.isValidationFailed());
        return arg2;
    }

    public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
        logger.info(" getAsString Validation Result " + arg0.isValidationFailed());
        return (String) arg2;
    }
}
